﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace KWIS9000CLIENT
{
    public partial class Form1 : Form
    {
        private Button button1;
        private Button button2;
        private Button button3;
        private TextBox textBox1;
        private Button button4;
        private ListBox listBox1;
        private TextBox textboxTeamName;
        private GroupBox PLayerNamesGroup;
        private GroupBox teamNameGroup;
        private Button button5;
        private Button button6;
        private GroupBox startQuizGroup;
        KwisClient client;
        private String teamname;

        public Form1()
        {
            InitializeComponent();
        }

        private void InitializeComponent()
        {
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.button4 = new System.Windows.Forms.Button();
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.textboxTeamName = new System.Windows.Forms.TextBox();
            this.PLayerNamesGroup = new System.Windows.Forms.GroupBox();
            this.teamNameGroup = new System.Windows.Forms.GroupBox();
            this.button5 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.startQuizGroup = new System.Windows.Forms.GroupBox();
            this.PLayerNamesGroup.SuspendLayout();
            this.teamNameGroup.SuspendLayout();
            this.startQuizGroup.SuspendLayout();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(443, 566);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(414, 54);
            this.button1.TabIndex = 0;
            this.button1.Text = "Doe hem de groeten";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // button2
            // 
            this.button2.Location = new System.Drawing.Point(688, 504);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(169, 56);
            this.button2.TabIndex = 1;
            this.button2.Text = "disconnect";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // button3
            // 
            this.button3.Location = new System.Drawing.Point(110, 92);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(202, 56);
            this.button3.TabIndex = 2;
            this.button3.Text = "Start quiz";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            // 
            // textBox1
            // 
            this.textBox1.Location = new System.Drawing.Point(54, 32);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(309, 20);
            this.textBox1.TabIndex = 3;
            // 
            // button4
            // 
            this.button4.Location = new System.Drawing.Point(54, 58);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(309, 23);
            this.button4.TabIndex = 4;
            this.button4.Text = "speler toevoegen";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            // 
            // listBox1
            // 
            this.listBox1.FormattingEnabled = true;
            this.listBox1.Location = new System.Drawing.Point(54, 87);
            this.listBox1.Name = "listBox1";
            this.listBox1.Size = new System.Drawing.Size(309, 95);
            this.listBox1.TabIndex = 5;
            // 
            // textboxTeamName
            // 
            this.textboxTeamName.Location = new System.Drawing.Point(51, 87);
            this.textboxTeamName.Name = "textboxTeamName";
            this.textboxTeamName.Size = new System.Drawing.Size(309, 20);
            this.textboxTeamName.TabIndex = 6;
            // 
            // PLayerNamesGroup
            // 
            this.PLayerNamesGroup.Controls.Add(this.button6);
            this.PLayerNamesGroup.Controls.Add(this.textBox1);
            this.PLayerNamesGroup.Controls.Add(this.listBox1);
            this.PLayerNamesGroup.Controls.Add(this.button4);
            this.PLayerNamesGroup.Location = new System.Drawing.Point(438, 12);
            this.PLayerNamesGroup.Name = "PLayerNamesGroup";
            this.PLayerNamesGroup.Size = new System.Drawing.Size(419, 234);
            this.PLayerNamesGroup.TabIndex = 6;
            this.PLayerNamesGroup.TabStop = false;
            this.PLayerNamesGroup.Text = "Stel uw team samen";
            // 
            // teamNameGroup
            // 
            this.teamNameGroup.Controls.Add(this.button5);
            this.teamNameGroup.Controls.Add(this.textboxTeamName);
            this.teamNameGroup.Location = new System.Drawing.Point(17, 12);
            this.teamNameGroup.Name = "teamNameGroup";
            this.teamNameGroup.Size = new System.Drawing.Size(414, 234);
            this.teamNameGroup.TabIndex = 6;
            this.teamNameGroup.TabStop = false;
            this.teamNameGroup.Text = "Kies een naam voor uw team";
            // 
            // button5
            // 
            this.button5.Location = new System.Drawing.Point(324, 191);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(84, 37);
            this.button5.TabIndex = 6;
            this.button5.Text = "Volgende";
            this.button5.UseVisualStyleBackColor = true;
            this.button5.Click += new System.EventHandler(this.button5_Click);
            // 
            // button6
            // 
            this.button6.Location = new System.Drawing.Point(329, 191);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(84, 37);
            this.button6.TabIndex = 7;
            this.button6.Text = "Volgende";
            this.button6.UseVisualStyleBackColor = true;
            this.button6.Click += new System.EventHandler(this.button6_Click);
            // 
            // startQuizGroup
            // 
            this.startQuizGroup.Controls.Add(this.button3);
            this.startQuizGroup.Location = new System.Drawing.Point(438, 252);
            this.startQuizGroup.Name = "startQuizGroup";
            this.startQuizGroup.Size = new System.Drawing.Size(419, 234);
            this.startQuizGroup.TabIndex = 7;
            this.startQuizGroup.TabStop = false;
            this.startQuizGroup.Text = "START";
            // 
            // Form1
            // 
            this.ClientSize = new System.Drawing.Size(1174, 604);
            this.Controls.Add(this.startQuizGroup);
            this.Controls.Add(this.teamNameGroup);
            this.Controls.Add(this.PLayerNamesGroup);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Name = "Form1";
            this.Text = "Client";
            this.Load += new System.EventHandler(this.Form1_Load_1);
            this.PLayerNamesGroup.ResumeLayout(false);
            this.PLayerNamesGroup.PerformLayout();
            this.teamNameGroup.ResumeLayout(false);
            this.teamNameGroup.PerformLayout();
            this.startQuizGroup.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        private void Form1_Load_1(object sender, EventArgs e)
        {
            client = new KwisClient();
            client.connect(System.Environment.MachineName);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            client.sendData("lol");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            client.disconnect();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length > 0)
            {
                listBox1.Items.Add(textBox1.Text);
                textBox1.Clear();
            }
            else
            {
                MessageBox.Show("gelieve een naam in te geven eerst");
                textBox1.Focus();
            }
        }

        private void button5_Click(object sender, EventArgs e)
        {

            int posx = teamNameGroup.Left;
            int posy = teamNameGroup.Top;
            teamNameGroup.Hide();
            PLayerNamesGroup.Left = posx;
            PLayerNamesGroup.Top = posy;

            this.teamname = textboxTeamName.Text;

        }

        private void button6_Click(object sender, EventArgs e)
        {
            int posx = teamNameGroup.Left;
            int posy = teamNameGroup.Top;
            teamNameGroup.Hide();
            PLayerNamesGroup.Hide();
            startQuizGroup.Left = posx;
            startQuizGroup.Top = posy;
        }

    }
}
